<!-- 网页播放器:WMP/RealOne/Macromedia Flash Player
核心:编码和解码技术 相同  如:windows media流(asf(Advanced Stream Format),wma,wmv格式...)，Real流(rm,rmvb...)，更有MPEG系列编码格式(MP4/MP3格式...) -->
<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" class=OBJECT id=MediaPlayer width=196 height=196> 
	<param name="ShowStatusBar" value=0> 
	<param name="Filename" value="TP1-1.mp4"> 
	<!-- 这里不成功的原因在于codebase地址 -->
	<embed type="application/x-oleobject" codebase="TP1-1.mp4"></embed>
</object>

<!-- 没有使用效果 -->
<object id="player" height="64" width="260" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6"> 
	<param name="AutoStart" value="-1">
	<!--是否自动播放--> 
	<param name="Balance" value="0"> 
	<!--调整左右声道平衡,同上面旧播放器代码--> 
	<param name="enabled" value="-1"> 
	<!--播放器是否可人为控制--> 
	<param name="EnableContextMenu" value="-1"> 
	<!--是否启用上下文菜单--> 
	<param name="url" value="TP1-1.mp4"> 
	<!--播放的文件地址--> 
	<param name="PlayCount" value="1"> 
	<!--播放次数控制,为整数--> 
	<param name="rate" value="1"> 
	<!--播放速率控制,1为正常,允许小数,1.0-2.0--> 
	<param name="currentPosition" value="0"> 
	<!--控件设置:当前位置--> 
	<param name="currentMarker" value="0"> 
	<!--控件设置:当前标记--> 
	<param name="defaultFrame" value=""> 
	<!--显示默认框架--> 
	<param name="invokeURLs" value="0"> 
	<!--脚本命令设置:是否调用URL--> 
	<param name="baseURL" value=""> 
	<!--脚本命令设置:被调用的URL--> 
	<param name="stretchToFit" value="0"> 
	<!--是否按比例伸展--> 
	<param name="volume" value="50"> 
	<!--默认声音大小0%-100%,50则为50%--> 
	<param name="mute" value="0"> 
	<!--是否静音--> 
	<param name="uiMode" value="full"> 
	<!--播放器显示模式:Full显示全部;mini最简化;None不显示播放控制,只显示视频窗口;invisible全部不显示--> 
	<param name="windowlessVideo" value="0"> 
	<!--如果是0能允许全屏,否则只能在窗口中查看--> 
	<param name="fullScreen" value="0"> 
	<!--开始播放是否自动全屏--> 
	<param name="enableErrorDialogs" value="-1"> 
	<!--是否启用错误提示报告--> 
	<param name="SAMIStyle" value> 
	<!--SAMI样式--> 
	<param name="SAMILang" value> 
	<!--SAMI语言--> 
	<param name="SAMIFilename" value> 
	<!--字幕ID--> 
</object>

<video width="800" height="" controls="controls">
	<source src="TP1-1.mp4" type="video/mp4">
	</source>
	<!-- 	<source src="myvideo.ogv" type="video/ogg"></source>
	<source src="myvideo.webm" type="video/webm"></source> -->
	<object width="" height="" type="application/x-shockwave-flash" data="myvideo.swf">
		<param name="movie" value="myvideo.swf" />
		<param name="flashvars" value="autostart=true&amp;file=myvideo.swf" />
	</object>
	当前浏览器不支持 video直接播放，点击这里下载视频： <a href="myvideo.webm">下载视频</a>
</video>

<!-- SWFObject 范例： -->
<script type="text/javascript" src="swfobject.js"></script>
<div id="flashcontent">
	  This text is replaced by the Flash movie.
</div>
<script type="text/javascript">
	var so = new SWFObject("movie.swf", "mymovie", "200", "100", "7", "#336699");
	so.addParam("quality", "low"); //添加参数
	so.addVariable("variable2", "value2"); //变量
	so.useExpressInstall('expressinstall.swf'); //自动升级
	so.setAttribute('xiRedirectUrl', 'http://www.example.com/upgradefinished.html'); //重定向
	so.write("flashcontent");
</script>
<!-- 讲解:
var so = new SWFObject(swf, id, width, height, version, background-color [, quality, xiRedirectUrl, redirectUrl, detectKey]);
swf - SWF文件路径 id - 将用于给embed与object标签设定name  redirectUrl - 没有安装相应版本的播放器后自动跳转的目标地址 
优点:灵活,兼容IE5
getQueryParamValue()获取链接中的参数 -->

<script type="text/javascript">
	const MAX = Number.MAX_SAFE_INTEGER;
	// var buffer =  new ArrayBuffer(MAX);
	var buffer = new ArrayBuffer(200);
	console.log(buffer.byteLength)
	console.log(btoa(atob('abc'))) // atob() ascii transfer to binary     btoa()  注意base64编码规则在部分字符结尾会增加=
	console.log(b64EncodeUnicode(location.href))
	console.log(b64DecodeUnicode(b64EncodeUnicode(location.href)))


	// DOMString转ascii会出错
	function b64EncodeUnicode(str) {
		return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, function(match, p1) {
			return String.fromCharCode('0x' + p1);
		}));
	}
	// 将ascii转回DOMString
	function b64DecodeUnicode(str) {
		return decodeURIComponent(atob(str).split('').map(function(c) {
			return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
		}).join(''));
	}

	/**
	 * Data URL:data:[<mediatype>][;base64],<data>
	 * 其中data转换原理:每次3个8位转成4个6位(对映A-Za-z0-9+/)
	 */
	// 视图类型包括: [Int|Unit|Float][8|16|32]Array   flaot至少32位,64位只有float
	let eight = new Int8Array([1])
	console.log(eight)
	// BYTES_PER_ELEMENT 该数据类型所占字节数

	// ArrayBuffer转为字符串，参数为ArrayBuffer对象
	function ab2str(buf) {
		return String.fromCharCode.apply(null, new Uint16Array(buf));
	}
	console.log(ab2str(eight))

	// 字符串转为ArrayBuffer对象，参数为字符串
	function str2ab(str) {
		var buf = new ArrayBuffer(str.length * 2); // 每个字符占用2个字节
		var bufView = new Uint16Array(buf);
		for (var i = 0, strLen = str.length; i < strLen; i++) {
			bufView[i] = str.charCodeAt(i);
		}
		return buf;
	}

	let arg1 = 5,
		arg2 = 8;

	function myalert() {
		console.log(arguments)
	}
	myalert `arg1=${arg1},arg2=${arg2}`

	// 浏览器环境不支持？
	// 	let re = /(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/;
	// 	let replacetext = '2015-01-02'.replace(re, '$<day>/$<month>/$<year>')
	// 	console.log(replacetext)
	// 	console.log('$<day>')

	// 浮点数最小误差
	console.log(Number.EPSILON)

	var x = 1;

	function foo(x, y = function() {
		console.log(x);
		x = 2;
		console.log(x);

	}) {
		var x = 3;
		y();
		console.log(x);
	}
	foo()
	console.log(x)

	function Maker() {
		this.first_name = 'tom';
		this.last_name = 'jack';
		this.id = 1;
		this.job = null;
		this.feale = false;
		this.dream = undefined;
	}
	Maker.prototype.fullName = function() {
		return this.first_name + this.last_name;
	}

	let mix = (object) => ({
		with: (...mixins) => mixins.reduce(
			(c, mixin) => Object.create(
				c, Object.getOwnPropertyDescriptors(mixin)
			), object)
	});

	let a = {
		a: 'a'
	};
	let b = {
		b: 'b'
	};
	let c = {
		c: 'c'
	};
	let d = mix(c).with(a, b);

	console.dir(d)

	let obj1 = {
		a: 1,
		b: 2
	}
	let obj2 = {
		c: 3,
		...obj1
	}
	console.log(obj2)

	let map = new Map();
	map.set('fisrt name', 'jack');
	map.set('last name', 'tom');
	// 通过数组解构
	for (let [key, value] of map) {
		console.log([key, value])
	}

	// 如何使用yield变量传参数？
	function* dataConsumer() {
		console.log('Started');
		console.log(`1. ${yield}`);
		console.log(`2. ${yield}`);
		yield `${yield}` * 5;
		return 'result';
	}

	let genObj = dataConsumer();
	console.log(genObj.next())
	console.log(genObj.next('a'))
	console.log(genObj.next('b'))
	console.log(genObj.next(100))
	console.log(genObj.next(100))
	// 	第一次next(),运行到yeild所在行为止
	// 第二从next(),函数返回yeild后值,而next参数代替yeild参与计算
	// 使用 for of时注意,由于return得到的对象done为true,该值不会计入for of结果

	function* foo() {
		yield 'a';
		yield 'b';
	}

	function* bar() {
		yield 'x';
		yield* foo();
		yield 'y';
	}
	let i = 0;
	for (let key of bar()) {
		console.log(key, i++)
	}
	// 自动化流程
	function run(fn) {
		var gen = fn();

		function next(err, data) {
			var result = gen.next(data);
			if (result.done) return;
			result.value(next);
		}

		next();
	}

	var g = function*() {
		var f1 = yield readFileThunk('fileA');
		var f2 = yield readFileThunk('fileB');
		// ...
		var fn = yield readFileThunk('fileN');
	};

	function readFileThunk(str) {
		console.log(str)
		return function(fnc) {
			console.log(fnc);
			fnc()
		}
	}
	run(g);

	class Animal {
		constructor(arg) {

		};
		getcolor() {
			return this.color
		}
	}
	
	class Cat extends Animal {
		constructor(arg) {
			console.log(arg)
			super(arg)
			this.color = 'white'
			console.log(new.target)
		};
		// #color:'white'
		color() {
			return 'Cat'
		}
		static findcolor() {}
	}


var scope = 'global scope';
function checkscope(){
	var scope = 'scope';
	function f(){return scope}
	return f
}
var ff = checkscope()
console.log(ff)
console.log(ff())
</script>
